package com.binance.assetservice.web.service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

import com.binance.assetservice.data.models.ProductItem;
import com.binance.assetservice.vo.ProductItemVO;
import com.binance.assetservice.vo.request.product.FetchProductsRequest;
import com.binance.assetservice.vo.request.product.GetUserTradeFeeRequest;
import com.binance.assetservice.vo.request.product.PriceConvertRequest;
import com.binance.assetservice.vo.response.product.CurrencyResponse;
import com.binance.assetservice.vo.response.product.FetchProductsResponse;
import com.binance.assetservice.vo.response.product.GetUserTradeFeeResponse;
import com.binance.assetservice.vo.response.product.PriceConvertResponse;

public interface IProductService {

    List<ProductItem> getAllProducts() throws Exception;

    List<ProductItem> getProductByRuleId(Long ruleId) throws Exception;

    List<String> getVisibleSymbols();

    // public ProductItem getIfPresent(String symbol);

    public List<ProductItem> getBySymbols(String[] symbols);

    public void addProduct(ProductItem product);

    // public ProductItem getFromDb(String symbol);

    public ProductItem get(String symbol);

    public Double getSumCirculationBySymbol(String symbol);

    public Double getSumTotalBySymbol(String symbol);

    public BigDecimal getPrevClose(String symbol);

    public void updateProduct(ProductItemVO product);

    public void refreshProduct(String symbol, boolean refreshOtherServers);

    public void refreshProductAll(boolean refreshOtherServers);

    public Map<String, Object> getProductData(String symbol);

    public Double getFirstPrevClose(String symbol);

    /**
     * 获取人民币汇率
     * 
     * @return
     */
    public Double getCnyusd();

    /**
     * 获取法币汇率
     * 
     * @return
     */
    public CurrencyResponse getCurrency();

    public Map<String, Object> getUserTradeFee(Map<String, Object> param);

    public void refreshUserTradeFee(Long userId, String symbol, boolean refreshOtherServers);

    public void invalidateAllUserTradeFee(boolean refreshOtherServers);

    /**
     * 获取一个币种到另一个币种的最短路径
     * 
     * @param from
     * @param to
     * @return
     */
    public List<String> getShortestPath(String from, String to);

    List<FetchProductsResponse> fetchProducts(FetchProductsRequest body) throws Exception;

    // ==============================================================================

    // ==============================================================================
    public GetUserTradeFeeResponse getUserTradeFee(GetUserTradeFeeRequest body) throws Exception;

    // ==============================================================================
    public PriceConvertResponse priceConvert(PriceConvertRequest body) throws Exception;

    public BigDecimal getPrice(String from, String to, Date date);

}
